package br.com.rubrol.model;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

@Entity
@Table(name = "TblTransportadora")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "codigo",
    "razaoSocial",
    "cpnj",
    "endereco",
    "ddd",
    "telefone",
    "contato",
    "nomeFantasia",
    "observacao",
    "prestacaoServicos"
})
@XmlRootElement(name="transportadora")
public class Transportadora implements Serializable {
	private static final long serialVersionUID = 1L;
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
    @XmlElement(required = true)
	private Long codigo;
	@Column(length = 150)
    @XmlElement(required = true)
	private String razaoSocial;
	@Column(length = 20)
    @XmlElement(required = true)
	private String cpnj;
	@OneToOne(targetEntity = Endereco.class)
    @XmlElement(required = true)
	private Endereco endereco;
	@Column
    @XmlElement(required = true)
	private Integer ddd;
	@Column
    @XmlElement(required = true)
	private Integer telefone;
	@Column(length = 40)
    @XmlElement(required = true)
	private String contato;
	@Column(length = 100)
    @XmlElement(required = true)
	private String nomeFantasia;
	@Column(length = 255)
    @XmlElement(required = true)
	private String observacao;

	@OneToMany(targetEntity = Cidade.class, cascade = CascadeType.ALL)
	private Set<Cidade> prestacaoServicos = new HashSet<Cidade>();

	public Transportadora() {
	}

	public Long getCodigo() {
		return codigo;
	}

	public void setCodigo(Long codigo) {
		this.codigo = codigo;
	}

	public String getRazaoSocial() {
		return razaoSocial;
	}

	public void setRazaoSocial(String razaoSocial) {
		this.razaoSocial = razaoSocial;
	}

	public String getCpnj() {
		return cpnj;
	}

	public void setCpnj(String cpnj) {
		this.cpnj = cpnj;
	}

	public Endereco getEndereco() {
		return endereco;
	}

	public void setEndereco(Endereco endereco) {
		this.endereco = endereco;
	}

	public Integer getDdd() {
		return ddd;
	}

	public void setDdd(Integer ddd) {
		this.ddd = ddd;
	}

	public Integer getTelefone() {
		return telefone;
	}

	public void setTelefone(Integer telefone) {
		this.telefone = telefone;
	}

	public String getContato() {
		return contato;
	}

	public void setContato(String contato) {
		this.contato = contato;
	}

	public String getNomeFantasia() {
		return nomeFantasia;
	}

	public void setNomeFantasia(String nomeFantasia) {
		this.nomeFantasia = nomeFantasia;
	}

	public String getObservacao() {
		return observacao;
	}

	public void setObservacao(String observacao) {
		this.observacao = observacao;
	}

	public Set<Cidade> getPrestacaoServicos() {
		return prestacaoServicos;
	}

	public void setPrestacaoServicos(Set<Cidade> prestacaoServicos) {
		this.prestacaoServicos = prestacaoServicos;
	}

}
